<template>
    <div class="app-container margin-right12">
      <div class="main-page">
         <div class="left-part">
          
         </div>

        <div class="right-part">
             <el-form
                    ref="leftFormRef"
                    style="width:100%"
                    :model="leftForm"
                    :rules="rules"
                    size="small"
                    label-width="auto"
                >
               
                <el-row>
                    
                    <el-col :span="4">
                        <el-form-item label="姓名" prop="sickName">
                            <el-input v-model="leftForm.sickName" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="年龄">
                            <el-input  v-model="leftForm.age">
                              
                                <template #append>
                                    <el-select  style="width:50px"  v-model="leftForm.ageUnit" placeholder="leftForm.ageUnit">
                                        <el-option v-for="unit in age_unit" :label="unit.label" :value="unit.value" />
                                    </el-select>
                                </template>
                                
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="性别" prop="sex">
                            <el-select   v-model="leftForm.sex" placeholder="性别">
                                <el-option v-for="item in sys_user_sex" :label="item.label" :value="item.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="手术间" >
                            <el-select v-model="leftForm.is_allergy" placeholder="手术间">
                                <el-option v-for="item in deptList" :label="item.deptName" :value="item.deptId" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="住院号" >
                            <el-input v-model="leftForm.sickName" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="入院类型" >
                           
                        </el-form-item>
                    </el-col>
                     <el-col :span="4">
                        <el-form-item label="住院次数" prop="inNum">
                            <el-input v-model="leftForm.inNum" placeholder="住院次数" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="医保" prop="chargeCode">
                            <el-select   v-model="leftForm.chargeCode" placeholder="医保">
                                <el-option v-for="item in manage_charge_type" :label="item.label" :value="item.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="病区" >
                            <el-select   v-model="leftForm.chargeCode" placeholder="病区">
                                <el-option v-for="item in sickareaList" :label="item.sickName" :value="item.sickAreaId" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="ID" >
                           {{ leftForm.sourceId }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="床号" >
                            <el-input v-model="leftForm.bedNew" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="隔离" >
                           
                        </el-form-item>
                    </el-col>
                     <el-col :span="4">
                        <el-form-item label="手术类型" >
                            <el-input v-model="leftForm.endRemark" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="手术等级" >
                            <el-input v-model="leftForm.endRemark" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="身高" >
                          <el-input v-model="leftForm.height" placeholder="身高" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="体重" >
                          <el-input v-model="leftForm.weight" placeholder="体重" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="血型" >
                            <el-input v-model="leftForm.bloodType" placeholder="血型" />
                        </el-form-item>
                    </el-col>
                  
                     <el-col :span="24">
                        <el-form-item label="麻醉方式" >
                            <el-select   v-model="leftForm.apply_anes" placeholder="麻醉方式">
                                <el-option v-for="item in sys_user_sex" :label="item.label" :value="item.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                     <el-col :span="24">
                        <el-form-item label="过敏史" >
                            <el-input
                                v-model="leftForm.allergy"
                               
                                placeholder="过敏内容"
                                
                                >
                                <template #prepend>
                                    <el-select style="width:90px" v-model="leftForm.is_allergy" placeholder="是否过敏">
                                        <el-option label="有过敏" value="1" />
                                        <el-option label="无过敏" value="0" />
                                       
                                    </el-select>
                                </template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                     <el-col :span="24">
                        <el-form-item label="术前诊断" >
                            <el-input v-model="leftForm.before_name" placeholder="术前诊断" />
                        </el-form-item>
                    </el-col>
                     <el-col :span="24">
                        <el-form-item label="术后诊断" >
                            <el-input v-model="leftForm.after_name" placeholder="术后诊断" />
                        </el-form-item>
                    </el-col>
                     <el-col :span="24">
                        <el-form-item label="拟施手术" >
                            <el-input v-model="leftForm.plan_name" placeholder="拟施手术" />
                        </el-form-item>
                    </el-col>
                     <el-col :span="24">
                        <el-form-item label="实施手术" >
                            <el-input v-model="leftForm.apply_name" placeholder="实施手术" />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
           


          






            <el-row>
                <el-col class="common-wrap" :span="12">
                    <el-table :data="tableData" border style="width: 100%;margin-top:12px">
                        <el-table-column prop="date" label="编码" />
                        <el-table-column prop="name" label="名称" />
                        <el-table-column prop="结果" label="操作" />
                    </el-table>
                </el-col>
                <el-col class="common-wrap" :span="12">
                    <el-table :data="tableData" border style="width: 100%;margin-top:12px">
                        <el-table-column prop="date" label="编码" />
                        <el-table-column prop="name" label="名称" />
                        <el-table-column prop="name" label="部位" />
                        <el-table-column prop="name" label="切口等级" />
                        <el-table-column prop="结果" label="操作" />
                    </el-table>
                </el-col>
               
            </el-row>
          
        </div>

      </div>

     
       
       <el-dialog
        v-model="dialogVisible"
        title="出室时间"
        width="500"
    >
        <el-date-picker
            v-model="leftForm.endTime"
            value-format="YYYY-MM-DD HH:mm:ss"
            type="datetime"
            placeholder="出室时间"
        />
        <template #footer>
        <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取消</el-button>
            <el-button type="primary" @click="dialogVisible = false">
                确定出室
            </el-button>
        </div>
        </template>
    </el-dialog>

     
       
    </div>
  </template>
  
  <script setup>
  import dayjs from "dayjs";
  import useSickpersonStore from "@/store/modules/sickperson";
  import useSurgeryingStore from '@/store/modules/surgerying'
  import { listSickarea } from "@/api/manage/sickarea";
  import { listUser } from "@/api/system/user";
  import { listNursschedul,addNursschedul,delNursschedul } from "@/api/manage/nursschedul";
  import { listSurgeryworker,addSurgeryworker } from "@/api/manage/surgeryworker";
  import { listDept } from "@/api/system/dept";
  const { proxy } = getCurrentInstance();
  const { manage_charge_type,sys_user_sex,age_unit } = proxy.useDict('manage_charge_type','sys_user_sex','age_unit');


    let leftForm=ref({
        
    })
    let deptList=ref([]);
    let sickareaList=ref([]);
    for(let key in useSickpersonStore().sickperson){
        leftForm.value[key]=useSickpersonStore().sickperson[key]
    }

    for(let key in useSurgeryingStore().surgerying){
        leftForm.value[key]=useSurgeryingStore().surgerying[key]
    }

    /** 查询集团列表 */
    function getDepList() {

        listDept({depType:5}).then(response => {
            deptList.value = response.data
        });
    }

    /** 查询病区列表 */
    function getSickAreaList() {
       
        listSickarea({}).then(response => {
            sickareaList.value = response.rows;
        
        });
    }
    
    

    let dialogVisible=ref(false);
    let locationOptions=[];
    let tableData=ref([]);
    let rules=ref([]);










    getDepList();
    getSickAreaList()
  </script>

  <style lang="scss">
    .margin-right12{
      .el-form--inline .el-form-item{
        margin-right:12px!important;
      }
    }
  </style>

  <style lang="scss" scoped>
     
    .flex-wrap{
      display:flex;
      align-items: center;
      margin-bottom:14px;
      .card-header{
        display:flex;
        align-items: center;
        justify-content: space-between;
      }
      .user-wrap{
        width:25%;
        display:flex;
        align-items: center;
        margin-right:8px;
      }
      .label{
        text-align: right;
        width:105px;
      }
      .content{
        width:70%;
      }
    }
    .app-container{
      height:100%;
    }
    .main-page{
      height:100%;
      display:flex;
      .left-part{
        box-sizing: border-box;
        padding-top:10px;
        height:100%;
        overflow: auto;
        margin-right:18px;
      }
      .right-part{
        .common-wrap{
            padding:20px 10px 0 10px;
        }
        .btns-wrap{
            display:flex;
            align-content: center;
            justify-content: space-between;
        }
        flex:1;
        height:100%;
        overflow: auto;
      }
    }
  </style>


  